//
//  TuiJianViewCell.m
//  lovergotest
//
//  Created by liudonghuan on 14-8-13.
//  Copyright (c) 2014年 liudonghuan. All rights reserved.
//

#import "TuiJianViewCell.h"

@implementation TuiJianViewCell
@synthesize leftline = _leftline;
@synthesize collection = _collection;
@synthesize mainimage = _mainimage;
@synthesize onelabel = _onelabel;
@synthesize twolabel = _twolabel;
@synthesize collectionnum = _collectionnum;
@synthesize tjCollectDelegate = _tjCollectDelegate;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _collectStatus = nocollect;
        _leftline = [[UIImageView alloc]initWithFrame:CGRectMake(20, 150, 3, 40)];
        [_leftline setBackgroundColor:[UIColor colorWithRed:102/255.0 green:221/255.0 blue:225/255.0 alpha:1]];
        
        _mainimage = [[EMAsyncImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
        _onelabel = [[UILabel alloc]initWithFrame:CGRectMake(25, 147, 300, 25)];
        _onelabel.font = [UIFont fontWithName:@"Helvetica" size:13];
        [_onelabel setTextColor:[UIColor colorWithRed:102/255.0 green:221/255.0 blue:225/255.0 alpha:1]];
        _twolabel = [[UILabel alloc]initWithFrame:CGRectMake(25, 167, 300, 25)];
        _twolabel.font = [UIFont fontWithName:@"Helvetica" size:15];
        [_twolabel setTextColor:[UIColor whiteColor]];
        //cell中的收藏块
        _collectview = [[UIButton alloc]initWithFrame:CGRectMake(260, 145, 50, 50)];
        UIImage *collectbg = [UIImage imageNamed:@"ico_collection_bg.png"];
        UIImage *collectbgselect = [UIImage imageNamed:@"ico_collection_bg_select.png"];
        [_collectview setBackgroundImage:collectbg forState:UIControlStateNormal];
        [_collectview setBackgroundImage:collectbgselect forState:UIControlStateSelected];
        _collectionImage = [[UIImageView alloc]initWithFrame:CGRectMake(277.5, 155, 15, 15)];
        _collectionImage.image = [UIImage imageNamed:@"tuijian_cell_coll.png"];
        _collectionnum = [[UILabel alloc]initWithFrame:CGRectMake(259.5, 165, 50, 30)];
        _collectionnum.textAlignment = UITextAlignmentCenter;
        _collectionnum.font = [UIFont fontWithName:@"Helvetica" size:13];
        [_collectionnum setTextColor:[UIColor whiteColor]];
        [_collectview addTarget:self action:@selector(collectOnclick) forControlEvents:UIControlEventTouchUpInside];
        //黑底
        _blackbg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 140, SCREEN_WIDTH, 60)];
//        UIImage *backgroundImage = [UIImage imageNamed:@"yingyin_tuijiancell.png"];
//        UIColor *backgroundColor = [UIColor colorWithPatternImage:backgroundImage];
//        [_blackbg setBackgroundColor:backgroundColor];
        _blackbg.image = [UIImage imageNamed:@"yingyin_tuijiancell.png"];
        [self addSubview:_mainimage];
        [self addSubview:_blackbg];
        [self addSubview:_leftline];
        [self addSubview:_collection];
        [self addSubview:_onelabel];
        [self addSubview:_twolabel];
        [self addSubview:_collectview];
        [self addSubview:_collectionImage];
        [self addSubview:_collectionnum];
        
        
    }
    return self;
}


-(void)collectOnclick
{
    [_tjCollectDelegate addToCollection:self];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
